<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>申诉调解</title>
<jsp:include page="../include.jsp"></jsp:include>
<script type="text/javascript">
function validInput(){
	
	if($('#name').val() == null || $('#name').val() == ""){
		$('#msg').html("请录入姓名");
		$('#name').focus();
		return false;
	}
	if(!$('#idType').val()){
		$('#msg').html("请录选择证件类型");
		$('#idType').focus();
		return false;
	}
	if(!$('#idNo').val()){
		$('#msg').html("请录入证件号码");
		$('#idNo').focus();
		return false;
	}
	if(!$('#phone').val()){
		$('#msg').html("请录入联系电话");
		$('#phone').focus();
		return false;
	}
	return true;
}
jQuery(function($){
	
	$('#confCheck').click(function(){
		if(validInput()){
			$.ajax({
				  type: 'POST',
				  url: '../appeal/application',
				  async: false,//是否异步
				  contentType: "application/json; charset=utf-8",
			      data: JSON.stringify($('#AppFM').serializeJSON())
				  ,success: function(d){
					  if(d.error != null && d.error == 1){
						  $('#msg').html(d.msg);
					  }else{
						  $("#msg").css("color","#008B8B")
						  $('#msg').html(d.msg);
					  }
				  }
				  ,error:function(d){
					  //TODO SOMETHING
					  $('#msg').html(d.msg);
				  }
			});
		}
	});
});

</script>
</head>
<body> 
<div data-role="main">
	<div data-role="header" data-theme="b">
	  <h1>申诉调解</h1>
	</div>
  <div data-role="content">
    <p><span id="msg" style="color: red"></span></p>
    <form method="post" action="" id="AppFM">
      <label for="name">申诉人姓名：</label>
      <input type="text" name="name" id="name">
      <fieldset data-role="fieldcontain">
        <label for="idType">申诉人证件类型：</label>
        <select name="idType" id="idType">
		<optgroup label="证件类型">
            <option value="01" selected="selected">身份证</option>
            <option value="02">户口本</option>
            <option value="03">护照</option>
        </optgroup></select></fieldset>
      <label for="idNo">申诉人证件号：</label>
      <input type="text" name="idNo" id="idNo">
      <fieldset data-role="fieldcontain">
        <label for="appType">申诉类型：</label>
        <select name="appType" id="appType">
        <optgroup label="一般原因">
			<option value="AA">案件不予受理</option>
			<option value="AB">案件可疑退回</option>
			<option value="AC">案件处理超时</option>
	   </optgroup>
	   <optgroup label="特殊原因">
			<option value="BA">处理不公正</option>
			<option value="BB">受到威胁撤件</option>
		</optgroup>
	    <optgroup label="其他原因">
			<option value="CA">其他原因</option>
		</optgroup>
        </select>
      </fieldset>
      <label for="phone">联系电话：</label>
      <input type="text" name="phone" id="phone"></input>
      <a href="#" id="confCheck" data-role="button" data-icon="check" data-theme="b">确认申请</a>
    </form>
  </div>
</div>
</body>
</html>